package com.jscm.showHexBool;

import com.App;
import com.jscm.openselect.selectShowWindow;
import com.jscm.showAttribute.AttributePaneShow;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * 特征抓取窗口
 * 主要负责将字节数据 进行对比如果不同把数据标上??
 */
public class HexBoolWindow {
    public static Stage stage = new Stage();
    static {
        init();
    }

    private static void init() {
        stage.setTitle("特征分析工具[ 当前地址：0   当前长度：0 ] ");
        stage.setScene(new Scene(HexBoolPaneShow.pane));
        stage.setWidth(400);
        stage.setHeight(490);
        stage.setResizable(false);
        stage.setAlwaysOnTop(true);
        stage.initStyle(StageStyle.UTILITY);
        stage.getIcons().add(new Image("ico.png"));
        stage.getScene().getStylesheets().addAll(selectShowWindow.class.getClassLoader().getResource("style.css").toExternalForm());
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                stage.setX(App.stage.getX()+485);
                stage.setY(App.stage.getY());
            }
        };
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(timerTask, new Date(), 100);
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent event) {
                event.consume();
            }
        });
    }
}
